<template>
    
    <el-tabs v-model="activeTabName" class="demo-tabs" @tab-click="">

        <el-tab-pane label="基本信息" name="no_1">
            <TmpTotal  />
        </el-tab-pane>
        <!-- <el-tab-pane label="收货地址" name="no_2">
            <TmpAddress  />
        </el-tab-pane>
        <el-tab-pane label="商品信息" name="no_3">
            <TmpProduct  />
        </el-tab-pane> -->
        <el-tab-pane label="历史记录" name="no_4">
            <TmpHistory  />
        </el-tab-pane>  

    </el-tabs>
</template>

<script lang="ts" setup>
import { ref,provide } from 'vue';
import { useRoute } from 'vue-router';
import axios from 'axios';

import TmpTotal from './Edit/Total.vue';
import TmpHistory from './Edit/History.vue';
import TmpProduct from './Edit/Product.vue';

const VITE_URL = window.VITE_URL;
const route = useRoute();
const activeTabName = ref('no_1')
// let order_id:string|number  = 0;
let order_id:any = 0;
const order:any = ref<object>({

    
  status:''
})

provide('order', order)

const getOrderInfo = ()=>{

    const url:string = VITE_URL + '/admin.order/info?id=' + order_id;
    axios.get( url ).then( ( res:any ) => {

        order.value = res.data;
        order.value.status += ''; // 转换成字符串

    } );

}

const do_edit = ()=>{

}

const init = ()=>{

    order_id = route.params.id ? route.params.id : 0;

    if( order_id ){

        getOrderInfo();
    }

}

init();
</script>